package com.moco.launcher.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.moco.launcher.R;
import com.oazon.moco.serialport.SerialSend;

public class UpateActivity extends BaseActivity {
	private static final String TAG = "UpdateActivity";
	
	private LinearLayout mLayoutUpdateMoco;
	private LinearLayout mLayoutUpdateSys;
	private ImageView mImgViewBack;
	private Button mBtnTest;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.update_layout);
		
		mLayoutUpdateMoco = (LinearLayout)findViewById(R.id.id_btn_update_moco);
		mLayoutUpdateSys = (LinearLayout)findViewById(R.id.id_btn_update_sys);
		mImgViewBack = (ImageView)findViewById(R.id.id_btn_update_back);
		mBtnTest = (Button)findViewById(R.id.id_btn_update_test);
		
		mLayoutUpdateSys.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				
				SerialSend.getInstance().sendStatus(
						SerialSend.Serial_WATCHDOG_CLOSE);
				Intent intent = new Intent(UpateActivity.this, UpdateMsgActivity.class);
				intent.putExtra("packageName", "com.example.ota");
				startActivity(intent);
			}
		});

		mLayoutUpdateMoco.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(UpateActivity.this,UpdateMsgActivity.class);
				intent.putExtra("packageName", "com.moco.upserver");
				startActivity(intent);	
			}
		});
		
		mBtnTest.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				// TODO: 
			}
		});

		mImgViewBack.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});
	}

}
